<template>
  <div class="form">
    <el-form label-position="top" label-width="80px" :model="menuForm">
      <el-row :gutter="20">
        <el-col :span="12"><div>
          <el-form-item label-position="left" label="名称">
            <el-input v-model="menuForm.name"></el-input>
          </el-form-item>
        </div></el-col>
        <el-col :span="12"><div>
          <el-form-item label="表名">
            <el-input v-model="menuForm.tableName"></el-input>
          </el-form-item>
        </div></el-col>
      </el-row>
      <el-form-item label="备注">
        <el-input v-model="menuForm.remark"></el-input>
      </el-form-item>

      <div style="text-align: left;">
        <el-form-item>
          <el-button type="primary" @click="onAdd" size="small">保存</el-button>
          <el-button @click="onClose" size="small">取消</el-button>
        </el-form-item>
      </div>
    </el-form>
  </div>
</template>

<script>
import api from '@/api'

export default {
  name: 'curd-form-add',
  components: {
  },
  props: {
  },
  data () {
    return {
      menuForm: {
        formInfo: {}
      },
      randomKey: 0
    }
  },
  mounted () {
    this.init()
  },
  methods: {
    onAdd () {
      var param = this.menuForm
      param.parentId = this.parentId
      api.sysCurd.sysEntityInsert(param).then(res => {
        this.$message({ type: 'info', message: '已添加' })
        this.onClose()
        this.$emit('refresh')
      })
    },
    onClose () {
      this.$emit('closeDrawer')
    },
    init () {
    }
  }
}
</script>

<style lang="scss">
  .form {
    padding: 10px;
  }
</style>
